/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.fpuna.ii.electiva2.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author Lauri
 */
@Entity
@Table(name = "cliente")
@NamedQueries({
    @NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c"),
    @NamedQuery(name = "Cliente.findByClieCodigo", query = "SELECT c FROM Cliente c WHERE c.clieCodigo = :clieCodigo"),
    @NamedQuery(name = "Cliente.findByClieNombre", query = "SELECT c FROM Cliente c WHERE c.clieNombre = :clieNombre"), @NamedQuery(name = "Cliente.findByClieApellido", query = "SELECT c FROM Cliente c WHERE c.clieApellido = :clieApellido"), @NamedQuery(name = "Cliente.findByClieCi", query = "SELECT c FROM Cliente c WHERE c.clieCi = :clieCi"), @NamedQuery(name = "Cliente.findByClieDireccion", query = "SELECT c FROM Cliente c WHERE c.clieDireccion = :clieDireccion"),
    @NamedQuery(name = "Cliente.findByClieRuc", query = "SELECT c FROM Cliente c WHERE c.clieRuc = :clieRuc")
})
public class Cliente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id

    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="cliente_seq_generator")
    @SequenceGenerator(name="cliente_seq_generator", sequenceName="cliente_clie_codigo_seq", allocationSize=1)

    @Basic(optional = false)
    @Column(name = "clie_codigo")
    private Integer clieCodigo;

    @Basic(optional = false)
    @Column(name = "clie_nombre")
    private String clieNombre;
    @Basic(optional = false)
    @Column(name = "clie_apellido")
    private String clieApellido;
    @Basic(optional = false)
    @Column(name = "clie_ci")
    private String clieCi;
    @Column(name = "clie_direccion")
    private String clieDireccion;
    @Basic(optional = false)
    @Column(name = "clie_ruc")
    private String clieRuc;
    @OneToMany(mappedBy = "ventCliente")
    private Collection<Venta> ventaCollection = new ArrayList<Venta>();

    public Cliente() {
    }

    public Cliente(Integer clieCodigo) {
        this.clieCodigo = clieCodigo;
    }

    public Cliente(Integer clieCodigo, String clieNombre, String clieApellido, String clieCi, String clieDir, String clieRuc) {
        this.clieCodigo = clieCodigo;
        this.clieNombre = clieNombre;
        this.clieApellido = clieApellido;
        this.clieCi = clieCi;
        this.clieDireccion = clieDir;
        this.clieRuc = clieRuc;
    }

    public Integer getClieCodigo() {
        return clieCodigo;
    }

    public void setClieCodigo(Integer clieCodigo) {
        this.clieCodigo = clieCodigo;
    }

    public String getClieNombre() {
        return clieNombre;
    }

    public void setClieNombre(String clieNombre) {
        this.clieNombre = clieNombre;
    }

    public String getClieApellido() {
        return clieApellido;
    }

    public void setClieApellido(String clieApellido) {
        this.clieApellido = clieApellido;
    }

    public String getClieCi() {
        return clieCi;
    }

    public void setClieCi(String clieCi) {
        this.clieCi = clieCi;
    }

    public String getClieDireccion() {
        return clieDireccion;
    }

    public void setClieDireccion(String clieDireccion) {
        this.clieDireccion = clieDireccion;
    }

    public String getClieRuc() {
        return clieRuc;
    }

    public void setClieRuc(String clieRuc) {
        this.clieRuc = clieRuc;
    }

    public Collection<Venta> getVentaCollection() {
        return ventaCollection;
    }

    public void setVentaCollection(Collection<Venta> ventaCollection) {
        this.ventaCollection = ventaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (clieCodigo != null ? clieCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cliente)) {
            return false;
        }
        Cliente other = (Cliente) object;
        if ((this.clieCodigo == null && other.clieCodigo != null) || (this.clieCodigo != null && !this.clieCodigo.equals(other.clieCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.fpuna.ii.electiva2.entity.Cliente[clieCodigo=" + clieCodigo + "]";
    }

}
